package com.edu.exam.enums.student;

import com.edu.exam.enums.core.BaseEnum;

/**
 * 申请状态枚举
 *
 * @author System
 * @version 2.0.0
 */
public enum ChangeStatus implements BaseEnum {

    PENDING("PENDING", "待审批"),
    APPROVED("APPROVED", "已批准"),
    REJECTED("REJECTED", "已拒绝"),
    CANCELLED("CANCELLED", "已取消");

    private final String code;
    private final String description;

    ChangeStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getDescription() {
        return description;
    }

    public static ChangeStatus fromCode(String code) {
        for (ChangeStatus status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown ChangeStatus code: " + code);
    }

    @Override
    public String toString() {
        return this.code + "(" + this.description + ")";
    }
}
